fix(games): Caption Clash host-start + Siege self-heal#2
Merged
Conversation
… stuck DEFEAT Two showcase-breaking gameplay bugs found by driving the games in a browser (WS-level checks had missed them): Caption Clash — host could never start a match. The server handler's isVip() used ctx.firstPlayer, but the platform passes an empty player list to handlers, so firstPlayer was always undefined and nobody was the VIP. Derive the VIP from state.players (first present by sorted id) to match the client's own gating. Also prune absent players while in the lobby so a persistent room stops accumulating ghost roster entries. Siege — a persistent room stayed stuck on DEFEAT forever (the base takes damage even with no defenders, and there was no reset), so every new visitor saw an instant 'base destroyed'. Reset to a fresh siege when the first player enters a room and auto-restart a few seconds after any win/loss, keeping connected players respawned at full health. Tests: 8 new handler tests (host/non-VIP/solo start, lobby ghost prune, first-join reset, auto-restart timing). Full showcase suite 42 pass. Verified in prod: 8/8 playability checks — both games start/play, and the polluted PARTY1/SIEGE1 default rooms self-healed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two showcase-breaking gameplay bugs, found by actually driving the games in a browser (WS-level checks had missed them — connection worked, gameplay didn't).
Caption Clash — host could never start a match. The server handler's
isVip()usedctx.firstPlayer, but the platform passes an empty player list to handlers, sofirstPlayerwas alwaysundefined→ nobody was the VIP → the client showed "Start match" but the server silently rejected it. Fix: derive the VIP fromstate.players(first present by sorted id), matching the client's own gating. Also prune absent players while in the lobby so a persistent room stops accumulating ghost roster entries.Siege — stuck on DEFEAT forever. The base takes damage even with no defenders and there was no reset, so a persistent room's base ended up destroyed and every new visitor saw an instant "base destroyed." Fix: reset to a fresh siege when the first player enters a room, and auto-restart a few seconds after any win/loss (keeping connected players, respawned at full health).
Test plan